<?php
/**
 * Created by PhpStorm.
 * User: lyh
 * Date: 2016/9/14
 * Time: 12:54
 */
namespace Community\Model;
use Think\Model\RelationModel;
class UserRelationModel extends RelationModel{
    Protected $tableName='user';
    Protected $_link=array(
        'person_table'=>array(
            'mapping_type'=>self::MANY_TO_MANY,
            'foreign_key'=>'userid',//主表在中间表的字段
            'relation_foreign_key'=>'cid',
            'relation_table'=>'hd_user_person'
        ),
        'group_table'=>array(
            'mapping_type'=>self::MANY_TO_MANY,
            'foreign_key'=>'userid',//主表在中间表的字段
            'relation_foreign_key'=>'cid',
            'relation_table'=>'hd_user_group'
        ),
        'clinic_table'=>array(
            'mapping_type'=>self::MANY_TO_MANY,
            'foreign_key'=>'userid',//主表在中间表的字段
            'relation_foreign_key'=>'cid',
            'relation_table'=>'hd_user_clinic'
        ),

    );
}